﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Admin.aspx.cs" Inherits="MyShop.Admin" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div class="clear_both">                
                <nav>
                    <ul id="menu" >
                        <li style="display:inline;list-style:none;height:50px;margin:5px;">
                            <fieldset style="width:500px; margin-right:10px">
                                <legend >Products</legend>
                                <asp:Button ID="ButtonEditorGoods" runat="server" CausesValidation="false" OnClick="ButtonEditor_Click"
                                     CommandName="MoveOrder" Text="Editor Products" Width="171px"/>
                                <asp:Button ID="ButtonAddGoods" runat="server" CausesValidation="false"
                                     OnClick="ButtonEditor_Click" CommandName="MoveOrder" Text="Add Product" Width="171px"/>
                            </fieldset>
                        </li>
                        <li  style="display:inline;list-style:none;height:50px;margin:5px;">
                             <fieldset style="width:500px; margin-right:10px">
                                <legend >Orders</legend>
                                <asp:Button ID="ButtonEditorOrders" runat="server" CausesValidation="false" OnClick="ButtonEditor_Click" CommandName="MoveOrder" 
                                     Text="Editor Orders" Width="171px"/>
                            </fieldset>
                        </li>
                        <li  style="display:inline;list-style:none;height:50px;margin:5px;visibility:collapse" > 
                             <fieldset style="width:500px; margin-right:10px">
                                <legend >Users</legend>
                                <asp:Button ID="ButtonEditorUsers" runat="server" CausesValidation="false" OnClick="ButtonEditor_Click" CommandName="MoveOrder" 
                                    Text="Editor Users" Width="171px"/>
                                <asp:Button ID="ButtonAddUsers" runat="server" CausesValidation="false" OnClick="ButtonEditor_Click" CommandName="MoveOrder" 
                                    Text="Add Users" Width="171px"/>
                            </fieldset>                          
                        </li>
                    </ul>
                </nav>
            </div>
        <asp:Panel ID="ProductPrice" runat="server" Visible="false"> 
            <div  style="margin:20px;border: 1px solid #808080;padding:5px;height:350px"> Product Price:
       
    
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID" 
            DataSourceID="SqlDataSource1" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" 
            ForeColor="Black" GridLines="Vertical" Width="871px">
            <AlternatingRowStyle BackColor="White" />
            <Columns>                
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" Visible="false"/>
                <asp:BoundField DataField="GroupProduct" HeaderText="Group Product" ReadOnly="True"  SortExpression="GroupID" />
                <asp:BoundField DataField="Company" HeaderText="Company Product" ReadOnly="True"  SortExpression="CompanyID" />
                <asp:BoundField DataField="ModelName" HeaderText="Model Name" SortExpression="ModelName" ConvertEmptyStringToNull="False" NullDisplayText="Поле не может быть пустым" />
                <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
                <asp:BoundField DataField="Count" HeaderText="Count" SortExpression="Count" />
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True"/>
            </Columns>
            <FooterStyle BackColor="#CCCC99" />
            <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
            <RowStyle BackColor="#F7F7DE" />
            <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#FBFBF2" />
            <SortedAscendingHeaderStyle BackColor="#848384" />
            <SortedDescendingCellStyle BackColor="#EAEAD3" />
            <SortedDescendingHeaderStyle BackColor="#575357" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ShopConnectionString %>"
            UpdateCommand="Update Product SET ModelName=@ModelName, Description=@Description, Price=@Price, Count=@Count WHERE ID=@ID"
            DeleteCommand="DELETE FROM Product WHERE ID=@ID;"                     
            SelectCommand="SELECT 
            Product.ID, 
            Product.GroupID, 
            Product.CompanyID, 
            Product.ModelName, 
            Product.Description, 
            Product.Price, 
            Product.Count, 
            ProductCompany.Name AS [Company], 
            ProductGroup.Name AS [GroupProduct]
            FROM (Product INNER JOIN ProductCompany ON Product.CompanyID=ProductCompany.ID) 
            INNER JOIN ProductGroup ON Product.GroupID=ProductGroup.ID">
        </asp:SqlDataSource>     
    </div>
        </asp:Panel>
    <asp:Panel ID="OrdersPrice" runat="server" Visible="false"> 
        <div  style="margin:20px;border: 1px solid #808080;padding:5px;height:350px;"> Order Price:
             <asp:GridView ID="GridView2" runat="server" AllowPaging="True" AllowSorting="True" DataKeyNames="Id"
                  AutoGenerateColumns="False" BackColor="White" BorderColor="#DEDFDE"
                  BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="SqlDataSource2" ForeColor="Black" GridLines="Vertical">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
               <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" ReadOnly="True" SortExpression="Id" />
                <asp:BoundField DataField="FirstName" ReadOnly="True" HeaderText="FirstName" SortExpression="FirstName" />
                <asp:BoundField DataField="LastName" ReadOnly="True" HeaderText="LastName" SortExpression="LastName" />
                <asp:BoundField DataField="Email" ReadOnly="True" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="Phone" ReadOnly="True" HeaderText="Phone" SortExpression="Phone" />
                <asp:BoundField DataField="Delivery" ReadOnly="True" HeaderText="Delivery" SortExpression="Delivery" />
                <asp:BoundField DataField="DateOrder" ReadOnly="True" HeaderText="DateOrder" SortExpression="DateOrder" />
                <asp:BoundField DataField="StatusOrder" HeaderText="StatusOrder" SortExpression="StatusOrder" />
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True"/>
            </Columns>
            <FooterStyle BackColor="#CCCC99" />
            <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
            <RowStyle BackColor="#F7F7DE" />
            <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#FBFBF2" />
            <SortedAscendingHeaderStyle BackColor="#848384" />
            <SortedDescendingCellStyle BackColor="#EAEAD3" />
            <SortedDescendingHeaderStyle BackColor="#575357" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ShopConnectionString %>" 
            UpdateCommand="Update OrderedUsers SET StatusOrder=@StatusOrder WHERE Id=@Id"
            DeleteCommand="DELETE FROM OrderedUsers WHERE Id=@Id;"  
            SelectCommand="SELECT * FROM [OrderedUsers]"></asp:SqlDataSource>
        </div>
    </asp:Panel>
        
        <div>

        </div>
        <div>

        </div>
        <div>

        </div>
    </form>
</body>
</html>
